<?php
declare (strict_types=1);

namespace app\admin\validate;

use think\Validate;

class MemberValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'nickname'        => 'require|max:10',
        //'mobile'          => 'require|mobile',
        'member_group_id' => 'require|between:0,5',
        'portrait'        => 'max:200',
        'sort'            => 'integer|between:0,10000',
        'password|密码'     => 'min:6|max:20',
        'status'          => 'require|in:1,2,3',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'nickname.require' => '缺少用户名称',
        'nickname.max'     => '用户名称最多不能超过10个字符',
        'mobile.require'   => '缺少用户手机号',
        'mobile.mobile'    => '用户手机号格式不正确',
        'portrait.max'     => '用户头像超出长度',
        'sort.integer'     => '用户排序必须是Integer',
        'sort.beteween'    => '排序必须在1-10000之间',
        'status.require'   => '缺少用户状态',
        'status.integer'   => '用户状态必须是Integer',
        'status.in'        => '用户状态必须是1,2',
    ];
}
